package hlhj.fhp.burst

import android.content.Context
import android.content.Intent
import com.lzy.okgo.OkGo
import com.lzy.okgo.callback.StringCallback
import com.lzy.okgo.model.Response
import hlhj.fhp.burst.activitys.BurstAty
import hlhj.fhp.burst.activitys.CameraAty
import hlhj.fhp.burst.activitys.ToBurstAty
import hlhj.fhp.burst.fragment.BurstFgm

/**
 * Created by Administrator on 2018\5\15 0015.
 */
object BurstUtil {
    fun goHome(context:Context){
        val intent = Intent(context, BurstAty::class.java)
        context.startActivity(intent)
    }
    fun goCamera(context: Context){
        val intent = Intent(context, CameraAty::class.java)
        context.startActivity(intent)
    }
    fun goPub(context: Context){
        val intent = Intent(context, ToBurstAty::class.java)
        context.startActivity(intent)
    }
    fun setBase(baseUrl:String){
        Contents.PUBLICK_URL=baseUrl
    }

    fun getHomeFgm(context: Context): BurstFgm {
        val burstFgm = BurstFgm()
        return burstFgm
    }

    fun getCity() {
        OkGo.get<String>(Contents.loctionUrl)
                .params("output","json")
                .params("location","${Contents.Lat},${Contents.Long}")
                .params("ak","esNPFDwwsXWtsQfw4NMNmur1")
                .execute(object : StringCallback(){
                    override fun onSuccess(response: Response<String>?) {

                    }
                })
    }
}